﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using MSNPSharp;

namespace SBPweb.MediaCenter.Modules.Messenger.MSN.WF
{
    public partial class Personal : Form
    {
        private MSNPSharp.Messenger pMessenger;
        
        public Personal(MSNPSharp.Messenger Messenger)
        {
            InitializeComponent();
            pMessenger = Messenger;
        }

        private void pbDisplayPicture_DoubleClick(object sender, EventArgs e)
        {
            OpenFileDialog od = new OpenFileDialog();
            od.DefaultExt = "jpg";
            od.Filter = "Picture files (*.jpg)|*.jpg";
            DialogResult dr = od.ShowDialog();

            if (dr == DialogResult.OK)
            {
                this.pbDisplayPicture.Image = System.Drawing.Image.FromFile(od.FileName);
            }
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            DisplayImage di = new DisplayImage();
            di.Image = this.pbDisplayPicture.Image;

            pMessenger.Owner.Name = this.tbDisplayName.Text.Trim();
            pMessenger.Owner.PersonalMessage = new PersonalMessage(this.tbPersonalMessage.Text.Trim(), MediaType.None, null);
            PersonalMessage pm = new PersonalMessage(this.tbPersonalMessage.Text.Trim(), MediaType.None, null);
            pMessenger.Owner.DisplayImage = di;

            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

    }
}
